/**
 * File DAInamiteConstants.java Package robocup.component Project Robocup Date
 * Jan 30, 2005 Web www.dai-labor.de
 * 
 * @author Grzegorz Lehmann
 */
package robocup.component;

import java.lang.reflect.Field;

/**
 * <code>DAInamiteConstants</code> holds all constants used in the team.
 * 
 */
public final class DAInamiteConstants {

  /*****************************************************************************
   * Synchro
   ****************************************************************************/
  // sending after % of a cycle
  // if you encounter many holes -> lower this value
  // if you got a fast machine and a high lateVI == BodySense quote -> raise
  // it
  // max = 1., (depends on server load)
  // currently used only if we expect a VI to arrive in 2nd quarter
  // - otherwise we don't calculate an action after a BS
  public static final double SYNCHRO_SENDING_PERCENTAGE       = .8;

  /*****************************************************************************
   * Action
   ****************************************************************************/

  public static final double DRIBBLE_TURN_ANGLE               = 30.0;

  public static final int    INTERCEPT_OPPONENT_MAX_CYCLES    = 25;

  /*****************************************************************************
   * Tactics
   ****************************************************************************/

  // stamina
  /**
   * if stamina is above this value, player moves to strategic position.
   */
  public final static double STAMINA_THR_MAX                  = 7800;

  /** 0.9 * STAMINA_MAX */
  public final static double STAMINA_THR_HIGH                 = 6400;

  /** 0.8 * STAMINA_MAX */
  public final static double STAMINA_THR_MID                  = 4800;

  /** 0.8 * STAMINA_MAX */
  public final static double STAMINA_THR_MID_LOW              = 3200;

  /** 0.7 * STAMINA_MAX */
  public final static double STAMINA_THR_LOW                  = 2500;

  /*****************************************************************************
   * Worldmodel & factbase
   ****************************************************************************/
  public static final int    PLAYERSMODEL_MATCH_COUNTER_LIMIT = 30;

  /**
   * <code>FB_HIST_SIZE_C</code> history size for FactBase of the coach
   */
  public static final int    FB_HIST_SIZE_C                   = 5;

  /**
   * <code>DOUBLE_UNKNOWN</code> Unknown value from parser
   */
  public static final double DOUBLE_UNKNOWN                   = -999.99;

  /**
   * <code>WM_MAX_FLAGS</code> maximal flags count for position calculation
   */
  public static final int    WM_MAX_FLAGS                     = 5;

  /**
   * <code>WM_V_AGE_CONFIDENCE</code> maximum number of cycles in which we
   * don't see the ball but still believe to know where it is.
   */
  public static final int    WM_V_AGE_CONFIDENCE              = 7;

  /**
   * <code>WM_FLAG_RADIUS</code> radius around the flags in SConf used in
   * method SConf.getFlag(Vektor pos). Note that this value mustn't be greater
   * than 2.5, which is the half of the minimum distance between two flags.
   */
  public static final double WM_FLAG_RADIUS                   = 1.;

  /**
   * The maximum distance, a player should believe the pointto-dircetion of
   * teammates is reliable - otherwise noise is too large!
   */
  public static final double MAX_POINT_AT_NOTICE_DIST         = 14.0;

  public static final double WM_PLAYER_NEAR_BALL_DISTANCE     = 3.0;

  /**
   * The maximum value, a players stamina is encoded into a pointto
   */
  public static final double MAX_STAMINA_POINTED              = 3200.0;

  /**
   * The value that makes a players status change due to new stamina knowledge
   */
  public static final double STAMINA_STATUS_DIFF              = 500;

  /**
   * This is the maximum value, an angle for pointing the stamina is used!
   */
  public static final double STAMINA_MAX_POINT_ANGLE          = 150;

  /** ************* PROPHET ********************************* */

  // maximum amount of cycles analyzed for passing
  public static final int    PROPHET_MAX_CYCLES_PASSING       = 20;

  // maximum amount of cycles analyzed for ball-interception
  public static final int    PROPHET_MAX_CYCLES_INTERCEPTION  = 50;

  // maximum amount of cycles, a player should dash backwards
  // in ball-interception
  public static final int    PROPHET_MAX_BACKWARD             = 5;

  public static final int    PROPHET_MAX_INTERCEPT_DELAY      = 4;

  /*****************************************************************************
   * <code>printConstants</code> prints all WM constants on System.out
   */
  public static final void printWorldConstants() {

    final StringBuffer sBuff = new StringBuffer(200);
    sBuff.append("\nDAI-NAMITE team constants: \n");
    final Field[] fields = DAInamiteConstants.class.getFields();
    for (int i = 0; i < fields.length; i++) {
      sBuff.append(fields[i].getName());
      sBuff.append(" =\t");
      try {
        sBuff.append(fields[i].get(null).toString());
      }
      catch (final Exception e) {
        sBuff.append("unknown");
        e.printStackTrace();
      }
      sBuff.append("\n");
    }
    System.out.println(sBuff.toString());
  }
}
